package com.party.admin.web.dto.input.common;

import com.party.common.utils.DateUtils;

/**
 * 查询条件
 *
 * @author yifeng
 * @date 2018/7/18 0018
 * @time 下午 15:57
 */
public class CommonQuery {
    private String createStart;
    private String createEnd;
    private Integer timeType;

    public String getCreateStart() {
        return createStart;
    }

    public void setCreateStart(String createStart) {
        this.createStart = createStart;
    }

    public String getCreateEnd() {
        return createEnd;
    }

    public void setCreateEnd(String createEnd) {
        this.createEnd = createEnd;
    }

    public Integer getTimeType() {
        return timeType;
    }

    public void setTimeType(Integer timeType) {
        this.timeType = timeType;
        String now = DateUtils.todayDate();
        String endTime = DateUtils.todayDate();
        String startTime = null;
        if (this.timeType.equals(1)) {
            // 今天
            startTime = now;
        } else if (this.timeType.equals(2)) {
            // 本周
            startTime = DateUtils.formatDate(DateUtils.addDay(now, -7));
        } else if (this.timeType.equals(3)) {
            // 本月
            startTime = DateUtils.formatDate(DateUtils.addMonth(DateUtils.getTodayDate(), -1));
        }
        setCreateStart(startTime);
        setCreateEnd(endTime);
    }
}
